import QtQuick.Extras 1.4
import Qt.labs.platform 1.1
import QtQuick.Controls 2.15
import QtQuick 2.14
import QtQuick.Layouts 1.14
 import QtGraphicalEffects 1.12
Item {
    id:root
    width: 1024
    height: 600

    signal printAddClicked()
    signal quitClicked()
    signal lastFilePageClicked()
    signal nextFilePageClicked()
    signal deleteFileClicked()



    Rectangle{
        anchors.fill: parent
        // color: "transparent"

        Image {
            id: root_bacground
            source: "qrc:/img/bacground.png"
            anchors.fill: parent
        }
        //顶部
        Rectangle {
            id:_title
            anchors.top: parent.top
            width: 1024
            height: 60
            LinearGradient {
                        anchors.fill: parent
                        start: Qt.point(1024, 0)  // 从右侧开始
                        end: Qt.point(0, 0)    // 到左侧结束
                        gradient: Gradient {
                            GradientStop { position: 0.0; color: Qt.rgba(36/255.0, 207/255.0, 197/255.0, 0.8) }
                            GradientStop { position: 1.0; color: Qt.rgba(0/255.0, 28/255.0, 99/255.0, 0.8) }
                        }
                    }

            Rectangle {
                width: 60
                height: 60
                color: "transparent"
                anchors.leftMargin: 10
                MouseArea{
                    anchors.fill: parent
                    onReleased: {
                        img_back.source ="qrc:/img/left-arrow-white.png"
                        root.quitClicked()
                    }
                    onPressed: {
                        img_back.source ="qrc:/img/left-arrow-green.png"
                    }
                }
                Image {
                    id:img_back
                    height: 40
                    width: 40
                    source: "qrc:/img/left-arrow-white.png"
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.horizontalCenter: parent.horizontalCenter
                    // anchors.leftMargin: 10
                }
            }

            Label{
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.verticalCenter: parent.verticalCenter
                text: qsTr("WIFI")
                font{
                    family: "Microsoft YaHei"
                    pixelSize: 20
                    bold: true
                }
                color: "#fff"
            }
            Rectangle {
                width: 60
                height: 60
                color: "transparent"
                anchors.rightMargin: 10
                anchors.right: parent.right
                MouseArea{
                    anchors.fill: parent
                    onReleased: {

                        root.quitClicked()
                    }
                    onPressed: {

                    }
                }
                Label{
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.verticalCenter: parent.verticalCenter
                    text: qsTr("Close")
                    font{
                        family: "Microsoft YaHei"
                        pixelSize: 20
                        bold: true
                    }
                    color: "#fff"
                }
            }

        }
        //主界面
        Rectangle {
            color: "transparent"
            id:_main
            anchors.top: _title.bottom
            anchors.topMargin: 1
            width: 1024
            height: 540
            RowLayout{
                anchors.fill: parent
                spacing: 0
                //左边主体
                Rectangle{
                    id:left_view
                    width: 583
                    height: 524
                    color: "transparent"
                    Layout.leftMargin:  16
                    Layout.rightMargin: 16


                    ColumnLayout{
                        anchors.fill: parent

                        spacing: 1
                        Rectangle{
                            Layout.alignment: Qt.AlignTop
                            Layout.topMargin: 10
                            //文件显示框
                            width: 583
                            height: 424
                            color:Qt.rgba(255, 255, 255, 0.5)
                            //文件控件
                            ExFolder{
                              anchors.fill: parent
                              width: 583
                              height: 424
                            }

                        }

                        Rectangle{
                            Layout.alignment: Qt.AlignTop
                            Layout.bottomMargin: 20
                            //翻页
                            width: 583
                            height: 26
                            color:"transparent"
                            // RowLayout{
                            //     anchors.fill: parent
                            //     spacing: 30
                            Rectangle{

                                id:lastPage
                                width: 106
                                height: 26
                                radius: 13
                                anchors.left: parent.left
                                color:"#fff"

                                Label{
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    // anchors.bottom: parent.bottom
                                    // anchors.bottomMargin: 50
                                    anchors.horizontalCenterOffset: 10
                                    anchors.verticalCenter: parent.verticalCenter
                                    text: qsTr("上一页")
                                    font{
                                        family: "Microsoft YaHei"
                                        pixelSize: 14

                                    }
                                    color: "#23CCC3"
                                }

                                Image {
                                    id:img_lastPage
                                    height: 26
                                    width: 26
                                    source: "qrc:/img/left-arrow-green.png"
                                    anchors.left: parent.left
                                    anchors.leftMargin: 10
                                }

                                MouseArea{
                                    anchors.fill: parent
                                    onReleased: {
                                        img_lastPage.source ="qrc:/img/left-arrow-green.png"
                                        lastPage.color= "#fff"
                                        root.lastFilePageClicked()

                                    }
                                    onPressed: {
                                        img_lastPage.source ="qrc:/img/left-arrow-white.png"
                                        lastPage.color= "#cdcdcd"
                                    }
                                }

                            }

                            Rectangle{
                                id:nextPage
                                anchors.right: parent.right
                                anchors.bottomMargin: 20
                                width: 106
                                height: 26
                                radius: 13
                                color:"#fff"
                                Label{
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    // anchors.bottom: parent.bottom
                                    anchors.verticalCenter: parent.verticalCenter
                                    anchors.horizontalCenterOffset: -10
                                    // anchors.bottomMargin: 50
                                    text: qsTr("下一页")
                                    font{
                                        family: "Microsoft YaHei"
                                        pixelSize: 14

                                    }
                                    color: "#23CCC3"
                                }
                                Image {
                                    id:img_nextPage
                                    height: 26
                                    width: 26
                                    source: "qrc:/img/right-arrow-green.png"
                                    anchors.right: parent.right
                                    anchors.rightMargin: 10
                                }
                                MouseArea{
                                    anchors.fill: parent
                                    onReleased: {
                                        img_nextPage.source ="qrc:/img/right-arrow-green.png"
                                        nextPage.color= "#fff"
                                        root.nextFilePageClicked()
                                    }
                                    onPressed: {
                                        img_nextPage.source ="qrc:/img/right-arrow-white.png"
                                        nextPage.color="#cdcdcd"
                                    }
                                }
                            }
                        }
                    }


                    //}

                    Rectangle{

                        width: 148;
                        height: 48;
                        visible: true
                        anchors.bottom: parent.bottom
                        anchors.bottomMargin: 20
                        anchors.horizontalCenter:left_view.horizontalCenter
                        color:Qt.rgba(255, 255, 255, 0.7)
                        radius:10
                        RowLayout{

                            anchors.horizontalCenter: parent.horizontalCenter
                            anchors.verticalCenter: parent.verticalCenter
                            spacing: 4
                            Rectangle{
                                Layout.alignment: Qt.AlignVCenter
                                Layout.rightMargin: 4
                                width: 60
                                height: 44
                                color: "transparent"
                                Image {
                                    id: img_print
                                    source: "qrc:/img/print.png"
                                    anchors.horizontalCenter: parent.horizontalCenter
                                    anchors.verticalCenter: parent.verticalCenter
                                    width: 44
                                    height: 44
                                }



                                MouseArea{
                                    anchors.fill: parent
                                    onPressed: {
                                       img_print.width  -= 4
                                       img_print.height -= 4
                                    }
                                    onReleased: {
                                        img_print.width  += 4
                                        img_print.height += 4
                                        root.printAddClicked()
                                    }

                                }
                            }
                            Rectangle{
                                height: 28
                                width: 1
                                color: "#4564FF"
                                Layout.alignment: Qt.AlignHCenter |Qt.AlignVCenter
                            }

                            Rectangle{
                                width: 60
                                height: 44
                                Layout.alignment: Qt.AlignVCenter
                                Layout.leftMargin: 4
                                color: "transparent"
                                Image {
                                    id: img_delete
                                    source: "qrc:/img/delete.png"

                                    anchors.horizontalCenter: parent.horizontalCenter
                                    anchors.verticalCenter: parent.verticalCenter
                                    width: 44
                                    height: 44
                                }
                                MouseArea{
                                    anchors.fill: parent
                                    onPressed: {
                                       img_delete.width -=4
                                       img_delete.height -=4
                                    }
                                    onReleased: {
                                        img_delete.width  +=4
                                        img_delete.height +=4
                                        root.deleteFileClicked()
                                    }
                                }
                            }
                        }
                    }
                }
                //显示预览
                Rectangle {
                    id:preview
                    Layout.rightMargin: 16
                    Layout.topMargin: 20
                    Layout.alignment: Qt.AlignVCenter
                    Layout.bottomMargin: 20
                    width: 388
                    height: 475
                    color: Qt.rgba(255,255,255,0.5)
                    radius: 10

                    ExImageItemPreview{
                      anchors.fill: parent
                    }
                }


            }
        }


    }


}
